package com.szxy.hotel.mapper;

import com.szxy.hotel.entity.Hotelroom;
import com.szxy.hotel.entity.Room;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface HotelroomMapper {

    @Select("select * from hotelroom where hotel_type = #{roomtype}")
    @ResultMap("HotelroomResultMap")
    List<Hotelroom> selectAddType(@Param("roomtype") String roomtype);

    @Select("select * from hotelroom where hotel_id = #{roomId}")
    @ResultMap("HotelroomResultMap")
    Hotelroom findByhotelroomid(@Param("roomId") String roomId);

    @Update("update hotelroom set hotel_state = #{roomState} where hotel_id = #{roomId}")
    @ResultMap("HotelroomResultMap")
    void updateHotelstate(@Param("roomId") String roomId,@Param("roomState") String roomState);

    @Select("select * from hotelroom where hotel_state !=#{hotelState1} and hotel_state !=#{hotelState2} limit #{start},#{size}")
    @ResultMap("HotelroomResultMap")
    List<Hotelroom> findByPage(@Param("start") int start,@Param("size") int size,@Param("hotelState1") String hotelState1,@Param("hotelState2") String hotelState2);

    @Select("select * from hotelroom where hotel_state !=#{hotelState1} and hotel_state !=#{hotelState2}")
    @ResultMap("HotelroomResultMap")
    List<Hotelroom> selectCount(@Param("hotelState1") String hotelState1,@Param("hotelState2") String hotelState2);
}